import request from '@/untils/request'
import type { detail, departmentList, workingSchedule } from '@/api/hosDetail/type'
import type { UserResponseData, UserArr, dutyDoc } from '@/api/hosDetail/type'

enum API {
  GET_HOS_DETAIL = '/hosp/hospital/',
  // 获取科室信息
  GET_DEPARTMENT = '/hosp/hospital/department/',
  // 科室挂号 获取挂号信息
  GET_REG_INFO = '/hosp/hospital/auth/getBookingScheduleRule/',
  // 获取排班
  GET_OWNER = '/hosp/hospital/auth/findScheduleList/',
  // 获取就诊人信息
  GET_PEOPELE_INFO = '/user/patient/auth/findAll',
  // 获取值班医生信息
  GET_DOC_INFO = '/hosp/hospital/getSchedule/'
}

export const getHosDetail = (hoscode: string) =>
  request.get<any, detail>(API.GET_HOS_DETAIL + hoscode)

export const getDepartment = (hoscode: string) =>
  request.get<any, departmentList>(API.GET_DEPARTMENT + hoscode)

export const getRegInfo = (page: number, limit: number, hoscode: string, depcode: string) =>
  request.get<any, workingSchedule>(API.GET_REG_INFO + `${page}/${limit}/${hoscode}/${depcode}`)

export const getOwner = (hoscode: string, depcode: string, workDate: string) =>
  request.get<any, any>(API.GET_OWNER + `${hoscode}/${depcode}/${workDate}`)

export const getPeopleInfo = () => request.get<any, UserResponseData>(API.GET_PEOPELE_INFO)

export const getDocInfo = (scheduleId: string) =>
  request.get<any, dutyDoc>(API.GET_DOC_INFO + scheduleId)
